package routers

import (
	"tmall_go/controllers/back"

	"github.com/gin-gonic/gin"
)

func BackRoutersInit(r *gin.Engine) {
	// 后台
	backRouters := r.Group("/back")
	{
		// 登录
		backRouters.GET("/login", back.IndexController{}.IndexLogin)
		backRouters.POST("/doLogin", back.IndexController{}.DoLogin)
		// 欢迎
		backRouters.GET("/welcome", back.WelcomeController{}.Welcome)
		// 我的
		backRouters.GET("/mine/opt/:optTag", back.MineController{}.Mine)
		backRouters.GET("/mine/changePassword", back.MineController{}.ChangePassword)
		backRouters.POST("/mine/doUptPassword", back.MineController{}.DoUptPassword)

		// 用户管理
		backRouters.GET("/userMgr/curPage/:num", back.UserController{}.PageList)
		backRouters.POST("/doUser/:id", back.UserController{}.DoUser)
		backRouters.GET("/addUser", back.UserController{}.AddUser)
		backRouters.GET("/editUser/:id", back.UserController{}.EditUser)
		backRouters.GET("/deleteUser/:id", back.UserController{}.DeleteUser)
		backRouters.GET("/detailUser/:id", back.UserController{}.DetailUser)
		backRouters.GET("/userMgr/resetPwd/:id", back.UserController{}.ResetPwd)

		// 商品管理
		backRouters.GET("/goodsMgr/curPage/:num", back.GoodsController{}.PageList)
		backRouters.POST("/goodsMgr/doGoods/:id", back.GoodsController{}.DoGoods)
		backRouters.GET("/goodsMgr/add", back.GoodsController{}.AddGoods)
		backRouters.GET("/goodsMgr/edit/:id", back.GoodsController{}.EditGoods)
		backRouters.GET("/goodsMgr/delete/:id", back.GoodsController{}.DeleteGoods)
		backRouters.GET("/goodsMgr/detail/:id", back.GoodsController{}.DetailGoods)
	}
}
